package com.lisynet.tools.mytools.controller;


import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.lisynet.tools.mytools.entity.OpmSyncRecord;
import com.lisynet.tools.mytools.service.IOpmSyncRecordService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDateTime;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lisy
 * @since 2022-01-18
 */
@RestController
public class OpmSyncRecordController {
    @Resource
    private IOpmSyncRecordService iOpmSyncRecordService;

    @RequestMapping("/record/add")
    public String addRecord(){
        String id = IdUtil.simpleUUID();
        LocalDateTime now = LocalDateTime.now();
        OpmSyncRecord record = OpmSyncRecord.builder()
                .createDate(now)
                .syncNumber(1)
                .creator(1L)
                .syncPeople(id)
                .syncStatus(true)
                .syncTarget(id)
                .updater(2L)
                .updateDate(now)
                .syncSource("企业智能中台")
                .syncTime(now)
                .syncType("user")
                .build();
        iOpmSyncRecordService.addRecord(record);
        return DateUtil.now();
    }
}
